package com.cencat.service.Impl;

import com.cencat.domain.Student;
import com.cencat.mapper.StudentMapper;
import com.cencat.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("studentService")
@Transactional()
public class StudentServiceImpl implements StudentService{

    @Autowired
    private StudentMapper studentMapper;
    @Override
    public Student getStudentById(int id) {
        return studentMapper.getStudentById(id);
    }

    @Override
    public List<Student> getAll() {
        return studentMapper.getAll();
    }

    @Override
    public void addStudent(Student student) {
        studentMapper.addStudent(student);

    }

    @Override
    public void updateStudent(Student student) {
        studentMapper.updateStudent(student);

    }

    @Override
    public void deleteStudent(int id) {
        studentMapper.deleteStudent(id);
    }

    @Override
    public List<Student> getStudentByPage(int page, int size) {
        return studentMapper.getStudentByPage(page,size);
    }
}
